#!/bin/bash
#
# Powertop tab completion for bash.
#
# This is part of PowerTOP
#
# This program file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program in a file named COPYING; if not, write to the
# Free Software Foundation, Inc,
# 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA
# or just google for it.

_powertop()
{
    local cur prev words cword split
    _init_completion -s || return

	case $prev in
		'-C'|'--csv'|'--extech'|'-r'|'--html'|'-w'|'--workload')
			_filedir
			return 0
			;;
    esac

    local all_long_options=$( _parse_help "$1" )

    COMPREPLY=( $( compgen -W "${all_long_options}" -- "$cur" ) )

    return 0
}

# load the completion
complete -F _powertop powertop
